package com.ruoyi.file.controller;

import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.file.service.ISysModelFileService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author Administrator
 */
@RestController
@RequestMapping("Document")
public class SysModelFileController extends BaseController {

    @Resource
    ISysModelFileService sysModelFileService;


    @GetMapping("/excel")
    public void downloadExcel(HttpServletResponse response, HttpServletRequest request, @RequestParam String type) throws IOException {
        switch (type){
            case "1":
                sysModelFileService.downloadExcelTemplate(response,request,"template/HealthParameter.xlsx","指标指数表导入模版.xlsx");
                break;
            case "2":
                sysModelFileService.downloadExcelTemplate(response,request,"template/A03HealthTotalMarkDetail.xlsx","调价总量导入模版.xlsx");
                break;
            case "3":
                sysModelFileService.downloadExcelTemplate(response,request,"template/Hospital.xlsx","医院机构导入模版.xlsx");
                break;
            case "4":
                break;
            default:
                throw new RuntimeException("参数错误");
        }

    }
}
